﻿using System;
using System.ComponentModel.Composition;

namespace OrbitOne.CRMLyncInfoDashboard.CRM.OrganizationData
{
    public partial class LabContext
    {
        public LabContext()
            : this(new ClientScript())
        { }

        public LabContext(IClientScript clientScript)
            : this(new Uri(string.Format("{0}/xrmservices/2011/organizationdata.svc/", clientScript.GetServerUrl())))
        {
            this.
            UseDefaultCredentials = true;
            IgnoreMissingProperties = true;
        }

        public object GetEntitySet<T>()
        {
            return GetType().GetProperty(string.Format("{0}Set", typeof(T).Name)).GetValue(this, null);
        }
    }
}